package com.example.mall.common.ddd;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.io.Serializable;
import java.time.Instant;

/**
 * 抽象实体类，所有的实体类都需要继承此类
 *
 * @author Mickey
 * @since 2021/1/12
 */
@Data
@EqualsAndHashCode(callSuper = true)
public class AbstractEntity extends AggregateRoot implements Serializable {
    protected Long id;
    @TableField(fill = FieldFill.INSERT)
    protected Instant createdAt;
    @TableField(fill = FieldFill.INSERT_UPDATE)
    protected Instant updatedAt;
    @TableField(fill = FieldFill.INSERT)
    protected Long createdBy;
    @TableField(fill = FieldFill.INSERT_UPDATE)
    protected Long updatedBy;
    protected Long version;
    protected Integer deleted;

}
